import { FormSchema } from '/@/components/Table';
import { getDictDetailListApi } from '/@/api/sys/dict';
import { DataStatusEnum } from '/@/enums/sysEnum';

export const Permission = {
  ADD: 'microresource.novel.category.add',
  EDIT: 'microresource.novel.category.edit',
  DEL: 'microresource.novel.category.del',
};

export const formSchema: FormSchema[] = [
  {
    field: 'name',
    label: '名称',
    component: 'Input',
    rules: [
      { required: true, message: '请填写名称' },
      { max: 100, message: '名称最多100字' },
    ],
  },
  {
    field: 'orderNum',
    label: '排序编号',
    component: 'InputNumber',
    helpMessage: '排序编号越小，显示越靠前',
    rules: [{ required: true, message: '请填写排序编号' }],
  },
  {
    field: 'state',
    label: '状态',
    component: 'ApiRadioGroup',
    helpMessage: '禁用后用户端不再显示',
    componentProps: {
      api: getDictDetailListApi,
      params: {
        code: 'data_status',
      },
      isBtn: true,
    },
    defaultValue: DataStatusEnum.NORMAL,
  },
];
